home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / cocktail / puma.lha / puma / m2c / Scanner.c < prev    next >
C/C++ Source or Header  |  1992-09-25  |  49KB  |  1,723 lines

  1. #include "SYSTEM_.h"
  2.  
  3. #ifndef DEFINITION_Checks
  4. #include "Checks.h"
  5. #endif
  6.  
  7. #ifndef DEFINITION_System
  8. #include "System.h"
  9. #endif
  10.  
  11. #ifndef DEFINITION_General
  12. #include "General.h"
  13. #endif
  14.  
  15. #ifndef DEFINITION_Positions
  16. #include "Positions.h"
  17. #endif
  18.  
  19. #ifndef DEFINITION_IO
  20. #include "IO.h"
  21. #endif
  22.  
  23. #ifndef DEFINITION_DynArray
  24. #include "DynArray.h"
  25. #endif
  26.  
  27. #ifndef DEFINITION_Strings
  28. #include "Strings.h"
  29. #endif
  30.  
  31. #ifndef DEFINITION_Source
  32. #include "Source.h"
  33. #endif
  34.  
  35. #ifndef DEFINITION_StringMem
  36. #include "StringMem.h"
  37. #endif
  38.  
  39. #ifndef DEFINITION_Strings
  40. #include "Strings.h"
  41. #endif
  42.  
  43. #ifndef DEFINITION_Idents
  44. #include "Idents.h"
  45. #endif
  46.  
  47. #ifndef DEFINITION_Texts
  48. #include "Texts.h"
  49. #endif
  50.  
  51. #ifndef DEFINITION_Sets
  52. #include "Sets.h"
  53. #endif
  54.  
  55. #ifndef DEFINITION_Tree
  56. #include "Tree.h"
  57. #endif
  58.  
  59. #ifndef DEFINITION_Positions
  60. #include "Positions.h"
  61. #endif
  62.  
  63. #ifndef DEFINITION_Errors
  64. #include "Errors.h"
  65. #endif
  66.  
  67. #ifndef DEFINITION_Scanner
  68. #include "Scanner.h"
  69. #endif
  70.  
  71. INTEGER Scanner_TokenLength;
  72. Scanner_tScanAttribute Scanner_Attribute;
  73. struct Scanner_11 Scanner_ScanTabName;
  74. PROC Scanner_Exit;
  75.  
  76. static INTEGER NestingLevel;
  77. static Positions_tPosition Position, StringPos;
  78. #define yyTabSpace    8
  79. #define yyDNoState    0
  80. #define yyFileStackSize    16
  81. #define yyInitBufferSize    (1024 * 8 + 256)
  82. #define yyFirstCh    '\0'
  83. #define yyLastCh    ((CHAR)'\177')
  84. #define yyEolCh    '\n'
  85. #define yyEobCh    ((CHAR)'\177')
  86. #define yyDStateCount    209
  87. #define yyTableSize    2236
  88. #define yyEobState    65
  89. #define yyDefaultState    66
  90. #define STD    1
  91. #define comment    3
  92. #define Str1    5
  93. #define Str2    7
  94. #define CStr1    9
  95. #define CStr2    11
  96. #define targetcode    13
  97. #define expr    15
  98. typedef SHORTCARD yyTableElmt;
  99. typedef yyTableElmt yyStateRange;
  100. typedef yyTableElmt yyTableRange;
  101. typedef struct S_1 {
  102.     yyStateRange Check, Next;
  103. } yyCombType;
  104. typedef yyCombType *yyCombTypePtr;
  105. typedef struct S_6 {
  106.     CHAR A[1000000 + 1];
  107. } *yytChBufferPtr;
  108. typedef CHAR yyChRange;
  109. static struct S_7 {
  110.     LONGCARD A[yyDStateCount + 1];
  111. } yyBasePtr;
  112. static struct S_8 {
  113.     yyStateRange A[yyDStateCount + 1];
  114. } yyDefault;
  115. static struct S_9 {
  116.     yyCombType A[yyTableSize + 1];
  117. } yyComb;
  118. static struct S_10 {
  119.     yyStateRange A[yyDStateCount + 1];
  120. } yyEobTrans;
  121. static struct S_11 {
  122.     CHAR A[yyLastCh + 1];
  123. } yyToLower, yyToUpper;
  124. static struct S_12 {
  125.     yyStateRange A[1000000 + 1];
  126. } *yyStateStack;
  127. static LONGINT yyStateStackSize;
  128. static yyStateRange yyStartState;
  129. static yyStateRange yyPreviousStart;
  130. static CHAR yyCh;
  131. static System_tFile yySourceFile;
  132. static BOOLEAN yyEof;
  133. static yytChBufferPtr yyChBufferPtr;
  134. static INTEGER yyChBufferStart;
  135. static LONGINT yyChBufferSize;
  136. static INTEGER yyChBufferIndex;
  137. static INTEGER yyBytesRead;
  138. static CARDINAL yyLineCount;
  139. static INTEGER yyLineStart;
  140. static SHORTCARD yyFileStackPtr;
  141. static struct S_13 {
  142.     struct S_14 {
  143.         System_tFile SourceFile;
  144.         BOOLEAN Eof;
  145.         yytChBufferPtr ChBufferPtr;
  146.         INTEGER ChBufferStart;
  147.         LONGINT ChBufferSize;
  148.         INTEGER ChBufferIndex;
  149.         INTEGER BytesRead;
  150.         CARDINAL LineCount;
  151.         INTEGER LineStart;
  152.     } A[yyFileStackSize - 1 + 1];
  153. } yyFileStack;
  154. static void yyInitialize ARGS(());
  155. static void yyStart ARGS((yyStateRange State));
  156. static void yyPrevious ARGS(());
  157. static void yyEcho ARGS(());
  158. static void yyLess ARGS((INTEGER n));
  159. static void yyTab ARGS(());
  160. static void yyTab1 ARGS((INTEGER a));
  161. static void yyTab2 ARGS((INTEGER a, INTEGER b));
  162. static void yyEol ARGS((INTEGER Column));
  163. static void output ARGS((CHAR c));
  164. static void unput ARGS((CHAR c));
  165. static CHAR input ARGS(());
  166. static void yyGetTables ARGS(());
  167. struct S_16 {
  168.     yyTableRange A[yyDStateCount + 1];
  169. };
  170. static CARDINAL yyGetTable ARGS((System_tFile TableFile, ADDRESS Address));
  171. static void yyErrorMessage ARGS((SHORTCARD ErrorCode));
  172. static void yyExit ARGS(());
  173.  
  174.  
  175. void Scanner_ErrorAttribute
  176. # ifdef __STDC__
  177. (INTEGER Token, Scanner_tScanAttribute *pAttribute)
  178. # else
  179. (Token, pAttribute)
  180. INTEGER Token;
  181. Scanner_tScanAttribute *pAttribute;
  182. # endif
  183. {
  184.   pAttribute->Position = Scanner_Attribute.Position;
  185.   switch (Token) {
  186.   case 1:;
  187.     pAttribute->U_1.V_1.Ident.Ident = Idents_NoIdent;
  188.     break;
  189.   case 2:;
  190.     pAttribute->U_1.V_2.Operator.Ident = Idents_NoIdent;
  191.     break;
  192.   case 3:;
  193.     pAttribute->U_1.V_3.IncOperator.Ident = Idents_NoIdent;
  194.     break;
  195.   case 4:;
  196.     Texts_MakeText(&pAttribute->U_1.V_4.TargetBlock.Text);
  197.     break;
  198.   case 5:;
  199.     pAttribute->U_1.V_5.String.StringRef = Idents_GetStringRef(Idents_NoIdent);
  200.     break;
  201.   case 6:;
  202.     pAttribute->U_1.V_6.Number.StringRef = Idents_GetStringRef(Idents_NoIdent);
  203.     break;
  204.   case 7:;
  205.     pAttribute->U_1.V_7.TargetCode.StringRef = Idents_GetStringRef(Idents_NoIdent);
  206.     break;
  207.   case 8:;
  208.     pAttribute->U_1.V_8.WhiteSpace.StringRef = Idents_GetStringRef(Idents_NoIdent);
  209.     break;
  210.   case 9:;
  211.     pAttribute->U_1.V_9.yy9.StringRef = Idents_GetStringRef(Idents_NoIdent);
  212.     break;
  213.   default :
  214.     break;
  215.   }
  216. }
  217.  
  218. void Scanner_Error
  219. # ifdef __STDC__
  220. (CHAR Text[], LONGCARD O_1, Positions_tPosition Position)
  221. # else
  222. (Text, O_1, Position)
  223. CHAR Text[];
  224. LONGCARD O_1;
  225. Positions_tPosition Position;
  226. # endif
  227. {
  228.   OPEN_ARRAY_LOCALS
  229.  
  230.   ALLOC_OPEN_ARRAYS(O_1 * sizeof(CHAR), 1)
  231.   COPY_OPEN_ARRAY(Text, O_1, CHAR)
  232.   Errors_Message(Text, O_1, (LONGCARD)Errors_Error, Position);
  233.   INC(Tree_ErrorCount);
  234.   FREE_OPEN_ARRAYS
  235. }
  236.  
  237. void Scanner_ErrorI
  238. # ifdef __STDC__
  239. (CHAR Text[], LONGCARD O_2, Positions_tPosition Position, Idents_tIdent Ident)
  240. # else
  241. (Text, O_2, Position, Ident)
  242. CHAR Text[];
  243. LONGCARD O_2;
  244. Positions_tPosition Position;
  245. Idents_tIdent Ident;
  246. # endif
  247. {
  248.   OPEN_ARRAY_LOCALS
  249.  
  250.   ALLOC_OPEN_ARRAYS(O_2 * sizeof(CHAR), 1)
  251.   COPY_OPEN_ARRAY(Text, O_2, CHAR)
  252.   Errors_MessageI(Text, O_2, (LONGCARD)Errors_Error, Position, (LONGCARD)Errors_Ident, ADR(Ident));
  253.   INC(Tree_ErrorCount);
  254.   FREE_OPEN_ARRAYS
  255. }
  256.  
  257. void Scanner_Warning
  258. # ifdef __STDC__
  259. (CHAR Text[], LONGCARD O_3, Positions_tPosition Position)
  260. # else
  261. (Text, O_3, Position)
  262. CHAR Text[];
  263. LONGCARD O_3;
  264. Positions_tPosition Position;
  265. # endif
  266. {
  267.   OPEN_ARRAY_LOCALS
  268.  
  269.   ALLOC_OPEN_ARRAYS(O_3 * sizeof(CHAR), 1)
  270.   COPY_OPEN_ARRAY(Text, O_3, CHAR)
  271.   if (!Sets_IsElement(ORD('s'), &Tree_Options)) {
  272.     Errors_Message(Text, O_3, (LONGCARD)Errors_Warning, Position);
  273.   }
  274.   FREE_OPEN_ARRAYS
  275. }
  276.  
  277. void Scanner_WarningI
  278. # ifdef __STDC__
  279. (CHAR Text[], LONGCARD O_4, Positions_tPosition Position, Idents_tIdent Ident)
  280. # else
  281. (Text, O_4, Position, Ident)
  282. CHAR Text[];
  283. LONGCARD O_4;
  284. Positions_tPosition Position;
  285. Idents_tIdent Ident;
  286. # endif
  287. {
  288.   OPEN_ARRAY_LOCALS
  289.  
  290.   ALLOC_OPEN_ARRAYS(O_4 * sizeof(CHAR), 1)
  291.   COPY_OPEN_ARRAY(Text, O_4, CHAR)
  292.   if (!Sets_IsElement(ORD('s'), &Tree_Options)) {
  293.     Errors_MessageI(Text, O_4, (LONGCARD)Errors_Warning, Position, (LONGCARD)Errors_Ident, ADR(Ident));
  294.   }
  295.   FREE_OPEN_ARRAYS
  296. }
  297.  
  298. INTEGER Scanner_GetToken
  299. # ifdef __STDC__
  300. ()
  301. # else
  302. ()
  303. # endif
  304. {
  305.   yyStateRange yyState;
  306.   yyCombTypePtr yyTablePtr;
  307.   BOOLEAN yyRestartFlag;
  308.   INTEGER yyi, yySource, yyTarget, yyChBufferFree;
  309.   Strings_tString Word, String, TargetCode;
  310.  
  311.   for (;;) {
  312.     yyState = yyStartState;
  313.     Scanner_TokenLength = 0;
  314.     for (;;) {
  315.       for (;;) {
  316.         yyTablePtr = (yyCombTypePtr)(yyBasePtr.A[yyState] + ORD(yyChBufferPtr->A[yyChBufferIndex]) * sizeof(yyCombType));
  317.         if (yyTablePtr->Check != yyState) {
  318.           yyState = yyDefault.A[yyState];
  319.           if (yyState == yyDNoState) {
  320.             goto EXIT_3;
  321.           }
  322.         } else {
  323.           yyState = yyTablePtr->Next;
  324.           INC(Scanner_TokenLength);
  325.           yyStateStack->A[Scanner_TokenLength] = yyState;
  326.           INC(yyChBufferIndex);
  327.         }
  328.       } EXIT_3:;
  329.       for (;;) {
  330.         switch (yyStateStack->A[Scanner_TokenLength]) {
  331.         case 209:;
  332.           Scanner_Attribute.Position.Line = yyLineCount;
  333.           Scanner_Attribute.Position.Column = yyChBufferIndex - yyLineStart - Scanner_TokenLength;
  334.           if (NestingLevel == 0) {
  335.             Texts_MakeText(&Scanner_Attribute.U_1.V_4.TargetBlock.Text);
  336.             Strings_AssignEmpty(&TargetCode);
  337.             Position = Scanner_Attribute.Position;
  338.           } else {
  339.             Scanner_GetWord(&Word);
  340.             Strings_Concatenate(&TargetCode, &Word);
  341.           }
  342.           INC(NestingLevel);
  343.           yyRestartFlag = FALSE;
  344.           goto EXIT_4;
  345.           break;
  346.         case 208:;
  347.           DEC(NestingLevel);
  348.           if (NestingLevel == 0) {
  349.             yyStart(STD);
  350.             Texts_Append(&Scanner_Attribute.U_1.V_4.TargetBlock.Text, &TargetCode);
  351.             Scanner_Attribute.Position = Position;
  352.             return 4;
  353.           } else {
  354.             Scanner_GetWord(&Word);
  355.             Strings_Concatenate(&TargetCode, &Word);
  356.           }
  357.           yyRestartFlag = FALSE;
  358.           goto EXIT_4;
  359.           break;
  360.         case 22:;
  361.         case 75:;
  362.           if (NestingLevel > 0) {
  363.             Scanner_GetWord(&Word);
  364.             Strings_Concatenate(&TargetCode, &Word);
  365.           }
  366.           yyRestartFlag = FALSE;
  367.           goto EXIT_4;
  368.           break;
  369.         case 207:;
  370.           if (NestingLevel > 0) {
  371.             Strings_Append(&TargetCode, '\t');
  372.           }
  373.           yyTab();
  374.           yyRestartFlag = FALSE;
  375.           goto EXIT_4;
  376.           break;
  377.         case 206:;
  378.           if (NestingLevel > 0) {
  379.             Texts_Append(&Scanner_Attribute.U_1.V_4.TargetBlock.Text, &TargetCode);
  380.             Strings_AssignEmpty(&TargetCode);
  381.           }
  382.           yyEol(0L);
  383.           yyRestartFlag = FALSE;
  384.           goto EXIT_4;
  385.           break;
  386.         case 23:;
  387.           if (NestingLevel > 0) {
  388.             Scanner_GetWord(&Word);
  389.             Strings_Append(&TargetCode, Strings_Char(&Word, 2));
  390.           }
  391.           yyRestartFlag = FALSE;
  392.           goto EXIT_4;
  393.           break;
  394.         case 37:;
  395.           if (NestingLevel > 0) {
  396.             Strings_Append(&TargetCode, '\\');
  397.           }
  398.           yyRestartFlag = FALSE;
  399.           goto EXIT_4;
  400.           break;
  401.         case 203:;
  402.         case 205:;
  403.           Scanner_Attribute.Position.Line = yyLineCount;
  404.           Scanner_Attribute.Position.Column = yyChBufferIndex - yyLineStart - Scanner_TokenLength;
  405.           yyStart(comment);
  406.           Position = Scanner_Attribute.Position;
  407.           yyRestartFlag = FALSE;
  408.           goto EXIT_4;
  409.           break;
  410.         case 201:;
  411.           yyPrevious();
  412.           yyRestartFlag = FALSE;
  413.           goto EXIT_4;
  414.           break;
  415.         case 28:;
  416.         case 42:;
  417.         case 70:;
  418.           yyRestartFlag = FALSE;
  419.           goto EXIT_4;
  420.           break;
  421.         case 30:;
  422.           yyRestartFlag = FALSE;
  423.           goto EXIT_4;
  424.           break;
  425.         case 29:;
  426.         case 43:;
  427.         case 59:;
  428.           Scanner_Attribute.Position.Line = yyLineCount;
  429.           Scanner_Attribute.Position.Column = yyChBufferIndex - yyLineStart - Scanner_TokenLength;
  430.           Scanner_GetWord(&Word);
  431.           Scanner_Attribute.U_1.V_6.Number.StringRef = StringMem_PutString(&Word);
  432.           return 6;
  433.           yyRestartFlag = FALSE;
  434.           goto EXIT_4;
  435.           break;
  436.         case 200:;
  437.           Scanner_Attribute.Position.Line = yyLineCount;
  438.           Scanner_Attribute.Position.Column = yyChBufferIndex - yyLineStart - Scanner_TokenLength;
  439.           Scanner_GetWord(&String);
  440.           StringPos = Scanner_Attribute.Position;
  441.           if (Sets_IsElement(ORD('c'), &Tree_Options)) {
  442.             yyStart(CStr1);
  443.           } else {
  444.             yyStart(Str1);
  445.           }
  446.           yyRestartFlag = FALSE;
  447.           goto EXIT_4;
  448.           break;
  449.         case 199:;
  450.           Scanner_Attribute.Position.Line = yyLineCount;
  451.           Scanner_Attribute.Position.Column = yyChBufferIndex - yyLineStart - Scanner_TokenLength;
  452.           Scanner_GetWord(&String);
  453.           StringPos = Scanner_Attribute.Position;
  454.           if (Sets_IsElement(ORD('c'), &Tree_Options)) {
  455.             yyStart(CStr2);
  456.           } else {
  457.             yyStart(Str2);
  458.           }
  459.           yyRestartFlag = FALSE;
  460.           goto EXIT_4;
  461.           break;
  462.         case 27:;
  463.         case 71:;
  464.           Scanner_GetWord(&Word);
  465.           Strings_Concatenate(&String, &Word);
  466.           yyRestartFlag = FALSE;
  467.           goto EXIT_4;
  468.           break;
  469.         case 26:;
  470.         case 72:;
  471.           Scanner_GetWord(&Word);
  472.           Strings_Concatenate(&String, &Word);
  473.           yyRestartFlag = FALSE;
  474.           goto EXIT_4;
  475.           break;
  476.         case 25:;
  477.         case 41:;
  478.         case 58:;
  479.         case 73:;
  480.           Scanner_GetWord(&Word);
  481.           Strings_Concatenate(&String, &Word);
  482.           yyRestartFlag = FALSE;
  483.           goto EXIT_4;
  484.           break;
  485.         case 24:;
  486.         case 40:;
  487.         case 57:;
  488.         case 74:;
  489.           Scanner_GetWord(&Word);
  490.           Strings_Concatenate(&String, &Word);
  491.           yyRestartFlag = FALSE;
  492.           goto EXIT_4;
  493.           break;
  494.         case 198:;
  495.           Scanner_GetWord(&Word);
  496.           Strings_Concatenate(&String, &Word);
  497.           yyEol(0L);
  498.           yyRestartFlag = FALSE;
  499.           goto EXIT_4;
  500.           break;
  501.         case 197:;
  502.           Scanner_GetWord(&Word);
  503.           Strings_Concatenate(&String, &Word);
  504.           yyEol(0L);
  505.           yyRestartFlag = FALSE;
  506.           goto EXIT_4;
  507.           break;
  508.         case 196:;
  509.           Strings_Append(&String, Strings_Char(&String, 1));
  510.           yyPrevious();
  511.           if (yyStartState == targetcode) {
  512.             Strings_Concatenate(&TargetCode, &String);
  513.           } else {
  514.             Scanner_Attribute.U_1.V_5.String.StringRef = StringMem_PutString(&String);
  515.             return 5;
  516.           }
  517.           yyRestartFlag = FALSE;
  518.           goto EXIT_4;
  519.           break;
  520.         case 195:;
  521.           Strings_Append(&String, Strings_Char(&String, 1));
  522.           yyPrevious();
  523.           if (yyStartState == targetcode) {
  524.             Strings_Concatenate(&TargetCode, &String);
  525.           } else {
  526.             Scanner_Attribute.U_1.V_5.String.StringRef = StringMem_PutString(&String);
  527.             return 5;
  528.           }
  529.           yyRestartFlag = FALSE;
  530.           goto EXIT_4;
  531.           break;
  532.         case 194:;
  533.           Strings_Append(&String, '\t');
  534.           yyTab();
  535.           yyRestartFlag = FALSE;
  536.           goto EXIT_4;
  537.           break;
  538.         case 193:;
  539.           Scanner_Error((STRING)"unclosed string", 15L, Scanner_Attribute.Position);
  540.           Strings_Append(&String, Strings_Char(&String, 1));
  541.           yyEol(0L);
  542.           yyPrevious();
  543.           if (yyStartState == targetcode) {
  544.             Strings_Concatenate(&TargetCode, &String);
  545.           } else {
  546.             Scanner_Attribute.U_1.V_5.String.StringRef = StringMem_PutString(&String);
  547.             return 5;
  548.           }
  549.           yyRestartFlag = FALSE;
  550.           goto EXIT_4;
  551.           break;
  552.         case 192:;
  553.           Scanner_Attribute.Position.Line = yyLineCount;
  554.           Scanner_Attribute.Position.Column = yyChBufferIndex - yyLineStart - Scanner_TokenLength;
  555.           return 9;
  556.           yyRestartFlag = FALSE;
  557.           goto EXIT_4;
  558.           break;
  559.         case 118:;
  560.           Scanner_Attribute.Position.Line = yyLineCount;
  561.           Scanner_Attribute.Position.Column = yyChBufferIndex - yyLineStart - Scanner_TokenLength;
  562.           if (NestingLevel == 0) {
  563.             Position = Scanner_Attribute.Position;
  564.           }
  565.           yyStart(expr);
  566.           INC(NestingLevel);
  567.           return 34;
  568.           yyRestartFlag = FALSE;
  569.           goto EXIT_4;
  570.           break;
  571.         case 18:;
  572.         case 35:;
  573.         case 204:;
  574.           Scanner_Attribute.Position.Line = yyLineCount;
  575.           Scanner_Attribute.Position.Column = yyChBufferIndex - yyLineStart - Scanner_TokenLength;
  576.           Scanner_GetWord(&Word);
  577.           Scanner_Attribute.U_1.V_7.TargetCode.StringRef = StringMem_PutString(&Word);
  578.           return 7;
  579.           yyRestartFlag = FALSE;
  580.           goto EXIT_4;
  581.           break;
  582.         case 191:;
  583.           Scanner_Attribute.Position.Line = yyLineCount;
  584.           Scanner_Attribute.Position.Column = yyChBufferIndex - yyLineStart - Scanner_TokenLength;
  585.           INC(NestingLevel);
  586.           Scanner_GetWord(&Word);
  587.           Scanner_Attribute.U_1.V_7.TargetCode.StringRef = StringMem_PutString(&Word);
  588.           return 7;
  589.           yyRestartFlag = FALSE;
  590.           goto EXIT_4;
  591.           break;
  592.         case 190:;
  593.           Scanner_Attribute.Position.Line = yyLineCount;
  594.           Scanner_Attribute.Position.Column = yyChBufferIndex - yyLineStart - Scanner_TokenLength;
  595.           DEC(NestingLevel);
  596.           if (NestingLevel == 0) {
  597.             yyStart(STD);
  598.             return 35;
  599.           } else {
  600.             Scanner_GetWord(&Word);
  601.             Scanner_Attribute.U_1.V_7.TargetCode.StringRef = StringMem_PutString(&Word);
  602.             return 7;
  603.           }
  604.           yyRestartFlag = FALSE;
  605.           goto EXIT_4;
  606.           break;
  607.         case 188:;
  608.           Scanner_Attribute.Position.Line = yyLineCount;
  609.           Scanner_Attribute.Position.Column = yyChBufferIndex - yyLineStart - Scanner_TokenLength;
  610.           Scanner_GetWord(&Word);
  611.           Scanner_Attribute.U_1.V_7.TargetCode.StringRef = StringMem_PutString(&Word);
  612.           return 7;
  613.           yyRestartFlag = FALSE;
  614.           goto EXIT_4;
  615.           break;
  616.         case 189:;
  617.           Scanner_Attribute.Position.Line = yyLineCount;
  618.           Scanner_Attribute.Position.Column = yyChBufferIndex - yyLineStart - Scanner_TokenLength;
  619.           Scanner_GetWord(&Word);
  620.           Scanner_Attribute.U_1.V_9.yy9.StringRef = StringMem_PutString(&Word);
  621.           return 9;
  622.           yyRestartFlag = FALSE;
  623.           goto EXIT_4;
  624.           break;
  625.         case 19:;
  626.         case 76:;
  627.           Scanner_Attribute.Position.Line = yyLineCount;
  628.           Scanner_Attribute.Position.Column = yyChBufferIndex - yyLineStart - Scanner_TokenLength;
  629.           Scanner_GetWord(&Word);
  630.           Scanner_Attribute.U_1.V_8.WhiteSpace.StringRef = StringMem_PutString(&Word);
  631.           return 8;
  632.           yyRestartFlag = FALSE;
  633.           goto EXIT_4;
  634.           break;
  635.         case 187:;
  636.           Scanner_Attribute.Position.Line = yyLineCount;
  637.           Scanner_Attribute.Position.Column = yyChBufferIndex - yyLineStart - Scanner_TokenLength;
  638.           Scanner_GetWord(&Word);
  639.           Scanner_Attribute.U_1.V_8.WhiteSpace.StringRef = StringMem_PutString(&Word);
  640.           yyEol(0L);
  641.           return 8;
  642.           yyRestartFlag = FALSE;
  643.           goto EXIT_4;
  644.           break;
  645.         case 186:;
  646.           Scanner_Attribute.Position.Line = yyLineCount;
  647.           Scanner_Attribute.Position.Column = yyChBufferIndex - yyLineStart - Scanner_TokenLength;
  648.           Scanner_GetWord(&Word);
  649.           Scanner_Attribute.U_1.V_8.WhiteSpace.StringRef = StringMem_PutString(&Word);
  650.           yyTab();
  651.           return 8;
  652.           yyRestartFlag = FALSE;
  653.           goto EXIT_4;
  654.           break;
  655.         case 21:;
  656.           Scanner_Attribute.Position.Line = yyLineCount;
  657.           Scanner_Attribute.Position.Column = yyChBufferIndex - yyLineStart - Scanner_TokenLength;
  658.           Scanner_GetWord(&Word);
  659.           Strings_SubString(&Word, 2, 2, &String);
  660.           Scanner_Attribute.U_1.V_7.TargetCode.StringRef = StringMem_PutString(&String);
  661.           return 7;
  662.           yyRestartFlag = FALSE;
  663.           goto EXIT_4;
  664.           break;
  665.         case 38:;
  666.           Scanner_Attribute.Position.Line = yyLineCount;
  667.           Scanner_Attribute.Position.Column = yyChBufferIndex - yyLineStart - Scanner_TokenLength;
  668.           Scanner_GetWord(&Word);
  669.           Scanner_Attribute.U_1.V_7.TargetCode.StringRef = StringMem_PutString(&Word);
  670.           return 7;
  671.           yyRestartFlag = FALSE;
  672.           goto EXIT_4;
  673.           break;
  674.         case 150:;
  675.           Scanner_Attribute.Position.Line = yyLineCount;
  676.           Scanner_Attribute.Position.Column = yyChBufferIndex - yyLineStart - Scanner_TokenLength;
  677.           yyStart(targetcode);
  678.           return 19;
  679.           yyRestartFlag = FALSE;
  680.           goto EXIT_4;
  681.           break;
  682.         case 145:;
  683.           Scanner_Attribute.Position.Line = yyLineCount;
  684.           Scanner_Attribute.Position.Column = yyChBufferIndex - yyLineStart - Scanner_TokenLength;
  685.           yyStart(targetcode);
  686.           return 20;
  687.           yyRestartFlag = FALSE;
  688.           goto EXIT_4;
  689.           break;
  690.         case 167:;
  691.           Scanner_Attribute.Position.Line = yyLineCount;
  692.           Scanner_Attribute.Position.Column = yyChBufferIndex - yyLineStart - Scanner_TokenLength;
  693.           yyStart(targetcode);
  694.           return 16;
  695.           yyRestartFlag = FALSE;
  696.           goto EXIT_4;
  697.           break;
  698.         case 156:;
  699.           Scanner_Attribute.Position.Line = yyLineCount;
  700.           Scanner_Attribute.Position.Column = yyChBufferIndex - yyLineStart - Scanner_TokenLength;
  701.           yyStart(targetcode);
  702.           return 18;
  703.           yyRestartFlag = FALSE;
  704.           goto EXIT_4;
  705.           break;
  706.         case 161:;
  707.           Scanner_Attribute.Position.Line = yyLineCount;
  708.           Scanner_Attribute.Position.Column = yyChBufferIndex - yyLineStart - Scanner_TokenLength;
  709.           yyStart(targetcode);
  710.           return 17;
  711.           yyRestartFlag = FALSE;
  712.           goto EXIT_4;
  713.           break;
  714.         case 126:;
  715.           Scanner_Attribute.Position.Line = yyLineCount;
  716.           Scanner_Attribute.Position.Column = yyChBufferIndex - yyLineStart - Scanner_TokenLength;
  717.           yyStart(targetcode);
  718.           return 30;
  719.           yyRestartFlag = FALSE;
  720.           goto EXIT_4;
  721.           break;
  722.         case 31:;
  723.         case 44:;
  724.         case 45:;
  725.         case 46:;
  726.         case 47:;
  727.         case 48:;
  728.         case 49:;
  729.         case 50:;
  730.         case 60:;
  731.         case 128:;
  732.         case 202:;
  733.           Scanner_Attribute.Position.Line = yyLineCount;
  734.           Scanner_Attribute.Position.Column = yyChBufferIndex - yyLineStart - Scanner_TokenLength;
  735.           Scanner_GetWord(&Word);
  736.           Scanner_Attribute.U_1.V_2.Operator.Ident = Idents_MakeIdent(&Word);
  737.           return 2;
  738.           yyRestartFlag = FALSE;
  739.           goto EXIT_4;
  740.           break;
  741.         case 33:;
  742.           Scanner_Attribute.Position.Line = yyLineCount;
  743.           Scanner_Attribute.Position.Column = yyChBufferIndex - yyLineStart - Scanner_TokenLength;
  744.           Scanner_GetWord(&Word);
  745.           Scanner_Attribute.U_1.V_3.IncOperator.Ident = Idents_MakeIdent(&Word);
  746.           return 3;
  747.           yyRestartFlag = FALSE;
  748.           goto EXIT_4;
  749.           break;
  750.         case 32:;
  751.           Scanner_Attribute.Position.Line = yyLineCount;
  752.           Scanner_Attribute.Position.Column = yyChBufferIndex - yyLineStart - Scanner_TokenLength;
  753.           Scanner_GetWord(&Word);
  754.           Strings_SubString(&Word, 2, (Strings_tStringIndex)Strings_Length(&Word), &String);
  755.           Scanner_Attribute.U_1.V_2.Operator.Ident = Idents_MakeIdent(&String);
  756.           return 2;
  757.           yyRestartFlag = FALSE;
  758.           goto EXIT_4;
  759.           break;
  760.         case 185:;
  761.           Scanner_Attribute.Position.Line = yyLineCount;
  762.           Scanner_Attribute.Position.Column = yyChBufferIndex - yyLineStart - Scanner_TokenLength;
  763.           return 10;
  764.           yyRestartFlag = FALSE;
  765.           goto EXIT_4;
  766.           break;
  767.         case 182:;
  768.           Scanner_Attribute.Position.Line = yyLineCount;
  769.           Scanner_Attribute.Position.Column = yyChBufferIndex - yyLineStart - Scanner_TokenLength;
  770.           return 11;
  771.           yyRestartFlag = FALSE;
  772.           goto EXIT_4;
  773.           break;
  774.         case 178:;
  775.           Scanner_Attribute.Position.Line = yyLineCount;
  776.           Scanner_Attribute.Position.Column = yyChBufferIndex - yyLineStart - Scanner_TokenLength;
  777.           return 12;
  778.           yyRestartFlag = FALSE;
  779.           goto EXIT_4;
  780.           break;
  781.         case 177:;
  782.           Scanner_Attribute.Position.Line = yyLineCount;
  783.           Scanner_Attribute.Position.Column = yyChBufferIndex - yyLineStart - Scanner_TokenLength;
  784.           return 13;
  785.           yyRestartFlag = FALSE;
  786.           goto EXIT_4;
  787.           break;
  788.         case 172:;
  789.           Scanner_Attribute.Position.Line = yyLineCount;
  790.           Scanner_Attribute.Position.Column = yyChBufferIndex - yyLineStart - Scanner_TokenLength;
  791.           return 14;
  792.           yyRestartFlag = FALSE;
  793.           goto EXIT_4;
  794.           break;
  795.         case 168:;
  796.           Scanner_Attribute.Position.Line = yyLineCount;
  797.           Scanner_Attribute.Position.Column = yyChBufferIndex - yyLineStart - Scanner_TokenLength;
  798.           return 15;
  799.           yyRestartFlag = FALSE;
  800.           goto EXIT_4;
  801.           break;
  802.         case 140:;
  803.           Scanner_Attribute.Position.Line = yyLineCount;
  804.           Scanner_Attribute.Position.Column = yyChBufferIndex - yyLineStart - Scanner_TokenLength;
  805.           return 21;
  806.           yyRestartFlag = FALSE;
  807.           goto EXIT_4;
  808.           break;
  809.         case 133:;
  810.           Scanner_Attribute.Position.Line = yyLineCount;
  811.           Scanner_Attribute.Position.Column = yyChBufferIndex - yyLineStart - Scanner_TokenLength;
  812.           return 22;
  813.           yyRestartFlag = FALSE;
  814.           goto EXIT_4;
  815.           break;
  816.         case 132:;
  817.           Scanner_Attribute.Position.Line = yyLineCount;
  818.           Scanner_Attribute.Position.Column = yyChBufferIndex - yyLineStart - Scanner_TokenLength;
  819.           return 23;
  820.           yyRestartFlag = FALSE;
  821.           goto EXIT_4;
  822.           break;
  823.         case 77:;
  824.           Scanner_Attribute.Position.Line = yyLineCount;
  825.           Scanner_Attribute.Position.Column = yyChBufferIndex - yyLineStart - Scanner_TokenLength;
  826.           return 24;
  827.           yyRestartFlag = FALSE;
  828.           goto EXIT_4;
  829.           break;
  830.         case 61:;
  831.           Scanner_Attribute.Position.Line = yyLineCount;
  832.           Scanner_Attribute.Position.Column = yyChBufferIndex - yyLineStart - Scanner_TokenLength;
  833.           return 25;
  834.           yyRestartFlag = FALSE;
  835.           goto EXIT_4;
  836.           break;
  837.         case 131:;
  838.           Scanner_Attribute.Position.Line = yyLineCount;
  839.           Scanner_Attribute.Position.Column = yyChBufferIndex - yyLineStart - Scanner_TokenLength;
  840.           return 26;
  841.           yyRestartFlag = FALSE;
  842.           goto EXIT_4;
  843.           break;
  844.         case 130:;
  845.           Scanner_Attribute.Position.Line = yyLineCount;
  846.           Scanner_Attribute.Position.Column = yyChBufferIndex - yyLineStart - Scanner_TokenLength;
  847.           return 27;
  848.           yyRestartFlag = FALSE;
  849.           goto EXIT_4;
  850.           break;
  851.         case 129:;
  852.           Scanner_Attribute.Position.Line = yyLineCount;
  853.           Scanner_Attribute.Position.Column = yyChBufferIndex - yyLineStart - Scanner_TokenLength;
  854.           return 28;
  855.           yyRestartFlag = FALSE;
  856.           goto EXIT_4;
  857.           break;
  858.         case 127:;
  859.           Scanner_Attribute.Position.Line = yyLineCount;
  860.           Scanner_Attribute.Position.Column = yyChBufferIndex - yyLineStart - Scanner_TokenLength;
  861.           return 29;
  862.           yyRestartFlag = FALSE;
  863.           goto EXIT_4;
  864.           break;
  865.         case 79:;
  866.           Scanner_Attribute.Position.Line = yyLineCount;
  867.           Scanner_Attribute.Position.Column = yyChBufferIndex - yyLineStart - Scanner_TokenLength;
  868.           return 31;
  869.           yyRestartFlag = FALSE;
  870.           goto EXIT_4;
  871.           break;
  872.         case 121:;
  873.           Scanner_Attribute.Position.Line = yyLineCount;
  874.           Scanner_Attribute.Position.Column = yyChBufferIndex - yyLineStart - Scanner_TokenLength;
  875.           return 32;
  876.           yyRestartFlag = FALSE;
  877.           goto EXIT_4;
  878.           break;
  879.         case 119:;
  880.           Scanner_Attribute.Position.Line = yyLineCount;
  881.           Scanner_Attribute.Position.Column = yyChBufferIndex - yyLineStart - Scanner_TokenLength;
  882.           return 33;
  883.           yyRestartFlag = FALSE;
  884.           goto EXIT_4;
  885.           break;
  886.         case 117:;
  887.           Scanner_Attribute.Position.Line = yyLineCount;
  888.           Scanner_Attribute.Position.Column = yyChBufferIndex - yyLineStart - Scanner_TokenLength;
  889.           return 35;
  890.           yyRestartFlag = FALSE;
  891.           goto EXIT_4;
  892.           break;
  893.         case 116:;
  894.           Scanner_Attribute.Position.Line = yyLineCount;
  895.           Scanner_Attribute.Position.Column = yyChBufferIndex - yyLineStart - Scanner_TokenLength;
  896.           return 36;
  897.           yyRestartFlag = FALSE;
  898.           goto EXIT_4;
  899.           break;
  900.         case 115:;
  901.           Scanner_Attribute.Position.Line = yyLineCount;
  902.           Scanner_Attribute.Position.Column = yyChBufferIndex - yyLineStart - Scanner_TokenLength;
  903.           return 37;
  904.           yyRestartFlag = FALSE;
  905.           goto EXIT_4;
  906.           break;
  907.         case 114:;
  908.           Scanner_Attribute.Position.Line = yyLineCount;
  909.           Scanner_Attribute.Position.Column = yyChBufferIndex - yyLineStart - Scanner_TokenLength;
  910.           return 38;
  911.           yyRestartFlag = FALSE;
  912.           goto EXIT_4;
  913.           break;
  914.         case 113:;
  915.           Scanner_Attribute.Position.Line = yyLineCount;
  916.           Scanner_Attribute.Position.Column = yyChBufferIndex - yyLineStart - Scanner_TokenLength;
  917.           return 39;
  918.           yyRestartFlag = FALSE;
  919.           goto EXIT_4;
  920.           break;
  921.         case 112:;
  922.           Scanner_Attribute.Position.Line = yyLineCount;
  923.           Scanner_Attribute.Position.Column = yyChBufferIndex - yyLineStart - Scanner_TokenLength;
  924.           return 40;
  925.           yyRestartFlag = FALSE;
  926.           goto EXIT_4;
  927.           break;
  928.         case 111:;
  929.           Scanner_Attribute.Position.Line = yyLineCount;
  930.           Scanner_Attribute.Position.Column = yyChBufferIndex - yyLineStart - Scanner_TokenLength;
  931.           return 41;
  932.           yyRestartFlag = FALSE;
  933.           goto EXIT_4;
  934.           break;
  935.         case 107:;
  936.           Scanner_Attribute.Position.Line = yyLineCount;
  937.           Scanner_Attribute.Position.Column = yyChBufferIndex - yyLineStart - Scanner_TokenLength;
  938.           return 42;
  939.           yyRestartFlag = FALSE;
  940.           goto EXIT_4;
  941.           break;
  942.         case 104:;
  943.           Scanner_Attribute.Position.Line = yyLineCount;
  944.           Scanner_Attribute.Position.Column = yyChBufferIndex - yyLineStart - Scanner_TokenLength;
  945.           return 43;
  946.           yyRestartFlag = FALSE;
  947.           goto EXIT_4;
  948.           break;
  949.         case 103:;
  950.           Scanner_Attribute.Position.Line = yyLineCount;
  951.           Scanner_Attribute.Position.Column = yyChBufferIndex - yyLineStart - Scanner_TokenLength;
  952.           return 44;
  953.           yyRestartFlag = FALSE;
  954.           goto EXIT_4;
  955.           break;
  956.         case 97:;
  957.           Scanner_Attribute.Position.Line = yyLineCount;
  958.           Scanner_Attribute.Position.Column = yyChBufferIndex - yyLineStart - Scanner_TokenLength;
  959.           return 45;
  960.           yyRestartFlag = FALSE;
  961.           goto EXIT_4;
  962.           break;
  963.         case 89:;
  964.           Scanner_Attribute.Position.Line = yyLineCount;
  965.           Scanner_Attribute.Position.Column = yyChBufferIndex - yyLineStart - Scanner_TokenLength;
  966.           return 46;
  967.           yyRestartFlag = FALSE;
  968.           goto EXIT_4;
  969.           break;
  970.         case 80:;
  971.           Scanner_Attribute.Position.Line = yyLineCount;
  972.           Scanner_Attribute.Position.Column = yyChBufferIndex - yyLineStart - Scanner_TokenLength;
  973.           return 31;
  974.           yyRestartFlag = FALSE;
  975.           goto EXIT_4;
  976.           break;
  977.         case 78:;
  978.           Scanner_Attribute.Position.Line = yyLineCount;
  979.           Scanner_Attribute.Position.Column = yyChBufferIndex - yyLineStart - Scanner_TokenLength;
  980.           return 40;
  981.           yyRestartFlag = FALSE;
  982.           goto EXIT_4;
  983.           break;
  984.         case 17:;
  985.         case 34:;
  986.         case 51:;
  987.         case 52:;
  988.         case 53:;
  989.         case 54:;
  990.         case 55:;
  991.         case 56:;
  992.         case 62:;
  993.         case 63:;
  994.         case 81:;
  995.         case 82:;
  996.         case 83:;
  997.         case 84:;
  998.         case 85:;
  999.         case 86:;
  1000.         case 87:;
  1001.         case 88:;
  1002.         case 90:;
  1003.         case 91:;
  1004.         case 92:;
  1005.         case 93:;
  1006.         case 94:;
  1007.         case 95:;
  1008.         case 96:;
  1009.         case 98:;
  1010.         case 99:;
  1011.         case 100:;
  1012.         case 101:;
  1013.         case 102:;
  1014.         case 105:;
  1015.         case 106:;
  1016.         case 108:;
  1017.         case 109:;
  1018.         case 110:;
  1019.         case 120:;
  1020.         case 122:;
  1021.         case 123:;
  1022.         case 124:;
  1023.         case 125:;
  1024.         case 134:;
  1025.         case 135:;
  1026.         case 136:;
  1027.         case 137:;
  1028.         case 138:;
  1029.         case 139:;
  1030.         case 141:;
  1031.         case 142:;
  1032.         case 143:;
  1033.         case 144:;
  1034.         case 146:;
  1035.         case 147:;
  1036.         case 148:;
  1037.         case 149:;
  1038.         case 151:;
  1039.         case 152:;
  1040.         case 153:;
  1041.         case 154:;
  1042.         case 155:;
  1043.         case 157:;
  1044.         case 158:;
  1045.         case 159:;
  1046.         case 160:;
  1047.         case 162:;
  1048.         case 163:;
  1049.         case 164:;
  1050.         case 165:;
  1051.         case 166:;
  1052.         case 169:;
  1053.         case 170:;
  1054.         case 171:;
  1055.         case 173:;
  1056.         case 174:;
  1057.         case 175:;
  1058.         case 176:;
  1059.         case 179:;
  1060.         case 180:;
  1061.         case 181:;
  1062.         case 183:;
  1063.         case 184:;
  1064.           Scanner_Attribute.Position.Line = yyLineCount;
  1065.           Scanner_Attribute.Position.Column = yyChBufferIndex - yyLineStart - Scanner_TokenLength;
  1066.           Scanner_GetWord(&Word);
  1067.           Scanner_Attribute.U_1.V_1.Ident.Ident = Idents_MakeIdent(&Word);
  1068.           return 1;
  1069.           yyRestartFlag = FALSE;
  1070.           goto EXIT_4;
  1071.           break;
  1072.         case 69:;
  1073.           while (yyChBufferPtr->A[yyChBufferIndex] == ' ') {
  1074.             INC(yyChBufferIndex);
  1075.           }
  1076.           yyRestartFlag = FALSE;
  1077.           goto EXIT_4;
  1078.           break;
  1079.         case 68:;
  1080.           DEC1(yyLineStart, 7 - (yyChBufferIndex - yyLineStart - 2) % 8);
  1081.           yyRestartFlag = FALSE;
  1082.           goto EXIT_4;
  1083.           break;
  1084.         case 67:;
  1085.           INC(yyLineCount);
  1086.           yyLineStart = yyChBufferIndex - 1;
  1087.           yyRestartFlag = FALSE;
  1088.           goto EXIT_4;
  1089.           break;
  1090.         case 1:;
  1091.         case 2:;
  1092.         case 3:;
  1093.         case 4:;
  1094.         case 5:;
  1095.         case 6:;
  1096.         case 7:;
  1097.         case 8:;
  1098.         case 9:;
  1099.         case 10:;
  1100.         case 11:;
  1101.         case 12:;
  1102.         case 13:;
  1103.         case 14:;
  1104.         case 15:;
  1105.         case 16:;
  1106.         case 20:;
  1107.         case 36:;
  1108.         case 39:;
  1109.         case 64:;
  1110.           DEC(yyChBufferIndex);
  1111.           DEC(Scanner_TokenLength);
  1112.           break;
  1113.         case 66:;
  1114.           Scanner_Attribute.Position.Line = yyLineCount;
  1115.           Scanner_Attribute.Position.Column = yyChBufferIndex - yyLineStart;
  1116.           INC(yyChBufferIndex);
  1117.           Scanner_TokenLength = 1;
  1118.           Scanner_GetWord(&Word);
  1119.           Errors_MessageI((STRING)"illegal character", 17L, (LONGCARD)Errors_Error, Scanner_Attribute.Position, (LONGCARD)Errors_String, ADR(Word));
  1120.           yyRestartFlag = FALSE;
  1121.           goto EXIT_4;
  1122.           break;
  1123.         case yyDNoState:;
  1124.           yyGetTables();
  1125.           yyStateStack->A[0] = yyDefaultState;
  1126.           if (yyFileStackPtr == 0) {
  1127.             yyInitialize();
  1128.             yySourceFile = System_StdInput;
  1129.           }
  1130.           yyRestartFlag = FALSE;
  1131.           goto EXIT_4;
  1132.           break;
  1133.         case 65:;
  1134.           DEC(yyChBufferIndex);
  1135.           DEC(Scanner_TokenLength);
  1136.           if (Scanner_TokenLength == 0) {
  1137.             yyState = yyStartState;
  1138.           } else {
  1139.             yyState = yyStateStack->A[Scanner_TokenLength];
  1140.           }
  1141.           if (yyChBufferIndex != yyChBufferStart + yyBytesRead) {
  1142.             yyState = yyEobTrans.A[yyState];
  1143.             if (yyState != yyDNoState) {
  1144.               INC(yyChBufferIndex);
  1145.               INC(Scanner_TokenLength);
  1146.               yyStateStack->A[Scanner_TokenLength] = yyState;
  1147.               yyRestartFlag = TRUE;
  1148.               goto EXIT_4;
  1149.             }
  1150.           } else {
  1151.             yySource = yyChBufferIndex - Scanner_TokenLength - 1;
  1152.             yyTarget = General_MaxAlign - Scanner_TokenLength % General_MaxAlign - 1;
  1153.             if (yySource != yyTarget) {
  1154.               {
  1155.                 LONGINT B_1 = 1, B_2 = Scanner_TokenLength;
  1156.  
  1157.                 if (B_1 <= B_2)
  1158.                   for (yyi = B_1;; yyi += 1) {
  1159.                     yyChBufferPtr->A[yyTarget + yyi] = yyChBufferPtr->A[yySource + yyi];
  1160.                     if (yyi >= B_2) break;
  1161.                   }
  1162.               }
  1163.               DEC1(yyLineStart, yySource - yyTarget);
  1164.               yyChBufferStart = yyTarget + Scanner_TokenLength + 1;
  1165.             } else {
  1166.               yyChBufferStart = yyChBufferIndex;
  1167.             }
  1168.             if (!yyEof) {
  1169.               yyChBufferFree = General_Exp2(General_Log2(yyChBufferSize - 4 - General_MaxAlign - Scanner_TokenLength));
  1170.               if (yyChBufferFree < yyChBufferSize / 8) {
  1171.                 DynArray_ExtendArray((ADDRESS *)&yyChBufferPtr, &yyChBufferSize, (LONGINT)sizeof(CHAR));
  1172.                 if (yyChBufferPtr == NIL) {
  1173.                   yyErrorMessage(1);
  1174.                 }
  1175.                 yyChBufferFree = General_Exp2(General_Log2(yyChBufferSize - 4 - General_MaxAlign - Scanner_TokenLength));
  1176.                 if (yyStateStackSize < yyChBufferSize) {
  1177.                   DynArray_ExtendArray((ADDRESS *)&yyStateStack, &yyStateStackSize, (LONGINT)sizeof(yyStateRange));
  1178.                   if (yyStateStack == NIL) {
  1179.                     yyErrorMessage(1);
  1180.                   }
  1181.                 }
  1182.               }
  1183.               yyChBufferIndex = yyChBufferStart;
  1184.               yyBytesRead = Source_GetLine(yySourceFile, ADR(yyChBufferPtr->A[yyChBufferIndex]), (LONGCARD)yyChBufferFree);
  1185.               if (yyBytesRead <= 0) {
  1186.                 yyBytesRead = 0;
  1187.                 yyEof = TRUE;
  1188.               }
  1189.               yyChBufferPtr->A[yyChBufferStart + yyBytesRead] = yyEobCh;
  1190.               yyChBufferPtr->A[yyChBufferStart + yyBytesRead + 1] = '\0';
  1191.               yyRestartFlag = TRUE;
  1192.               goto EXIT_4;
  1193.             }
  1194.             if (Scanner_TokenLength == 0) {
  1195.               Scanner_Attribute.Position.Line = yyLineCount;
  1196.               Scanner_Attribute.Position.Column = yyChBufferIndex - yyLineStart;
  1197.               Scanner_CloseFile();
  1198.               if (yyFileStackPtr == 0) {
  1199.                 switch (yyStartState) {
  1200.                 case comment:;
  1201.                   Scanner_Error((STRING)"unclosed comment", 16L, Position);
  1202.                   break;
  1203.                 case expr:;
  1204.                 case targetcode:;
  1205.                   Scanner_Error((STRING)"unclosed target code", 20L, Position);
  1206.                   break;
  1207.                 case CStr1:;
  1208.                 case CStr2:;
  1209.                 case Str1:;
  1210.                 case Str2:;
  1211.                   Scanner_Error((STRING)"unclosed string", 15L, StringPos);
  1212.                   break;
  1213.                 default :
  1214.                   break;
  1215.                 }
  1216.               }
  1217.               if (yyFileStackPtr == 0) {
  1218.                 return Scanner_EofToken;
  1219.               }
  1220.               yyRestartFlag = FALSE;
  1221.               goto EXIT_4;
  1222.             }
  1223.           }
  1224.           break;
  1225.         default :
  1226.           yyErrorMessage(0);
  1227.           break;
  1228.         }
  1229.       } EXIT_4:;
  1230.       if (yyRestartFlag) {
  1231.       } else {
  1232.         goto EXIT_2;
  1233.       }
  1234.     } EXIT_2:;
  1235.   } EXIT_1:;
  1236. }
  1237.  
  1238. void Scanner_BeginFile
  1239. # ifdef __STDC__
  1240. (CHAR FileName[], LONGCARD O_5)
  1241. # else
  1242. (FileName, O_5)
  1243. CHAR FileName[];
  1244. LONGCARD O_5;
  1245. # endif
  1246. {
  1247.   OPEN_ARRAY_LOCALS
  1248.  
  1249.   ALLOC_OPEN_ARRAYS(O_5 * sizeof(CHAR), 1)
  1250.   COPY_OPEN_ARRAY(FileName, O_5, CHAR)
  1251.   if (yyStateStack->A[0] == yyDNoState) {
  1252.     yyGetTables();
  1253.     yyStateStack->A[0] = yyDefaultState;
  1254.   }
  1255.   yyInitialize();
  1256.   yySourceFile = Source_BeginSource(FileName, O_5);
  1257.   if (yySourceFile < 0) {
  1258.     yyErrorMessage(5);
  1259.   }
  1260.   FREE_OPEN_ARRAYS
  1261. }
  1262.  
  1263. static void yyInitialize
  1264. # ifdef __STDC__
  1265. ()
  1266. # else
  1267. ()
  1268. # endif
  1269. {
  1270.   if (yyFileStackPtr >= yyFileStackSize) {
  1271.     yyErrorMessage(3);
  1272.   }
  1273.   INC(yyFileStackPtr);
  1274.   {
  1275.     register struct S_14 *W_1 = &yyFileStack.A[yyFileStackPtr - 1];
  1276.  
  1277.     W_1->SourceFile = yySourceFile;
  1278.     W_1->Eof = yyEof;
  1279.     W_1->ChBufferPtr = yyChBufferPtr;
  1280.     W_1->ChBufferStart = yyChBufferStart;
  1281.     W_1->ChBufferSize = yyChBufferSize;
  1282.     W_1->ChBufferIndex = yyChBufferIndex;
  1283.     W_1->BytesRead = yyBytesRead;
  1284.     W_1->LineCount = yyLineCount;
  1285.     W_1->LineStart = yyLineStart;
  1286.   }
  1287.   yyChBufferSize = yyInitBufferSize;
  1288.   DynArray_MakeArray((ADDRESS *)&yyChBufferPtr, &yyChBufferSize, (LONGINT)sizeof(CHAR));
  1289.   if (yyChBufferPtr == NIL) {
  1290.     yyErrorMessage(1);
  1291.   }
  1292.   yyChBufferStart = General_MaxAlign;
  1293.   yyChBufferPtr->A[yyChBufferStart - 1] = yyEolCh;
  1294.   yyChBufferPtr->A[yyChBufferStart] = yyEobCh;
  1295.   yyChBufferPtr->A[yyChBufferStart + 1] = '\0';
  1296.   yyChBufferIndex = yyChBufferStart;
  1297.   yyEof = FALSE;
  1298.   yyBytesRead = 0;
  1299.   yyLineCount = 1;
  1300.   yyLineStart = yyChBufferStart - 1;
  1301. }
  1302.  
  1303. void Scanner_CloseFile
  1304. # ifdef __STDC__
  1305. ()
  1306. # else
  1307. ()
  1308. # endif
  1309. {
  1310.   if (yyFileStackPtr == 0) {
  1311.     yyErrorMessage(4);
  1312.   }
  1313.   Source_CloseSource(yySourceFile);
  1314.   DynArray_ReleaseArray((ADDRESS *)&yyChBufferPtr, &yyChBufferSize, (LONGINT)sizeof(CHAR));
  1315.   {
  1316.     register struct S_14 *W_2 = &yyFileStack.A[yyFileStackPtr - 1];
  1317.  
  1318.     yySourceFile = W_2->SourceFile;
  1319.     yyEof = W_2->Eof;
  1320.     yyChBufferPtr = W_2->ChBufferPtr;
  1321.     yyChBufferStart = W_2->ChBufferStart;
  1322.     yyChBufferSize = W_2->ChBufferSize;
  1323.     yyChBufferIndex = W_2->ChBufferIndex;
  1324.     yyBytesRead = W_2->BytesRead;
  1325.     yyLineCount = W_2->LineCount;
  1326.     yyLineStart = W_2->LineStart;
  1327.   }
  1328.   DEC(yyFileStackPtr);
  1329. }
  1330.  
  1331. void Scanner_GetWord
  1332. # ifdef __STDC__
  1333. (Strings_tString *Word)
  1334. # else
  1335. (Word)
  1336. Strings_tString *Word;
  1337. # endif
  1338. {
  1339.   INTEGER i, WordStart;
  1340.  
  1341.   WordStart = yyChBufferIndex - Scanner_TokenLength - 1;
  1342.   {
  1343.     LONGINT B_3 = 1, B_4 = Scanner_TokenLength;
  1344.  
  1345.     if (B_3 <= B_4)
  1346.       for (i = B_3;; i += 1) {
  1347.         Word->Chars.A[i] = yyChBufferPtr->A[WordStart + i];
  1348.         if (i >= B_4) break;
  1349.       }
  1350.   }
  1351.   Word->Length = Scanner_TokenLength;
  1352. }
  1353.  
  1354. void Scanner_GetLower
  1355. # ifdef __STDC__
  1356. (Strings_tString *Word)
  1357. # else
  1358. (Word)
  1359. Strings_tString *Word;
  1360. # endif
  1361. {
  1362.   INTEGER i, WordStart;
  1363.  
  1364.   WordStart = yyChBufferIndex - Scanner_TokenLength - 1;
  1365.   {
  1366.     LONGINT B_5 = 1, B_6 = Scanner_TokenLength;
  1367.  
  1368.     if (B_5 <= B_6)
  1369.       for (i = B_5;; i += 1) {
  1370.         Word->Chars.A[i] = yyToLower.A[yyChBufferPtr->A[WordStart + i]];
  1371.         if (i >= B_6) break;
  1372.       }
  1373.   }
  1374.   Word->Length = Scanner_TokenLength;
  1375. }
  1376.  
  1377. void Scanner_GetUpper
  1378. # ifdef __STDC__
  1379. (Strings_tString *Word)
  1380. # else
  1381. (Word)
  1382. Strings_tString *Word;
  1383. # endif
  1384. {
  1385.   INTEGER i, WordStart;
  1386.  
  1387.   WordStart = yyChBufferIndex - Scanner_TokenLength - 1;
  1388.   {
  1389.     LONGINT B_7 = 1, B_8 = Scanner_TokenLength;
  1390.  
  1391.     if (B_7 <= B_8)
  1392.       for (i = B_7;; i += 1) {
  1393.         Word->Chars.A[i] = yyToUpper.A[yyChBufferPtr->A[WordStart + i]];
  1394.         if (i >= B_8) break;
  1395.       }
  1396.   }
  1397.   Word->Length = Scanner_TokenLength;
  1398. }
  1399.  
  1400. static void yyStart
  1401. # ifdef __STDC__
  1402. (yyStateRange State)
  1403. # else
  1404. (State)
  1405. yyStateRange State;
  1406. # endif
  1407. {
  1408.   yyPreviousStart = yyStartState;
  1409.   yyStartState = State;
  1410. }
  1411.  
  1412. static void yyPrevious
  1413. # ifdef __STDC__
  1414. ()
  1415. # else
  1416. ()
  1417. # endif
  1418. {
  1419.   yyStateRange s;
  1420.  
  1421.   s = yyStartState;
  1422.   yyStartState = yyPreviousStart;
  1423.   yyPreviousStart = s;
  1424. }
  1425.  
  1426. static void yyEcho
  1427. # ifdef __STDC__
  1428. ()
  1429. # else
  1430. ()
  1431. # endif
  1432. {
  1433.   INTEGER i;
  1434.  
  1435.   {
  1436.     LONGINT B_9 = yyChBufferIndex - Scanner_TokenLength, B_10 = yyChBufferIndex - 1;
  1437.  
  1438.     if (B_9 <= B_10)
  1439.       for (i = B_9;; i += 1) {
  1440.         IO_WriteC((System_tFile)IO_StdOutput, yyChBufferPtr->A[i]);
  1441.         if (i >= B_10) break;
  1442.       }
  1443.   }
  1444. }
  1445.  
  1446. static void yyLess
  1447. # ifdef __STDC__
  1448. (INTEGER n)
  1449. # else
  1450. (n)
  1451. INTEGER n;
  1452. # endif
  1453. {
  1454.   DEC1(yyChBufferIndex, Scanner_TokenLength - n);
  1455.   Scanner_TokenLength = n;
  1456. }
  1457.  
  1458. static void yyTab
  1459. # ifdef __STDC__
  1460. ()
  1461. # else
  1462. ()
  1463. # endif
  1464. {
  1465.   DEC1(yyLineStart, yyTabSpace - 1 - (yyChBufferIndex - yyLineStart - 2) % yyTabSpace);
  1466. }
  1467.  
  1468. static void yyTab1
  1469. # ifdef __STDC__
  1470. (INTEGER a)
  1471. # else
  1472. (a)
  1473. INTEGER a;
  1474. # endif
  1475. {
  1476.   DEC1(yyLineStart, yyTabSpace - 1 - (yyChBufferIndex - yyLineStart - Scanner_TokenLength + a - 1) % yyTabSpace);
  1477. }
  1478.  
  1479. static void yyTab2
  1480. # ifdef __STDC__
  1481. (INTEGER a, INTEGER b)
  1482. # else
  1483. (a, b)
  1484. INTEGER a, b;
  1485. # endif
  1486. {
  1487.   DEC1(yyLineStart, yyTabSpace - 1 - (yyChBufferIndex - yyLineStart - Scanner_TokenLength + a - 1) % yyTabSpace);
  1488. }
  1489.  
  1490. static void yyEol
  1491. # ifdef __STDC__
  1492. (INTEGER Column)
  1493. # else
  1494. (Column)
  1495. INTEGER Column;
  1496. # endif
  1497. {
  1498.   INC(yyLineCount);
  1499.   yyLineStart = yyChBufferIndex - 1 - Column;
  1500. }
  1501.  
  1502. static void output
  1503. # ifdef __STDC__
  1504. (CHAR c)
  1505. # else
  1506. (c)
  1507. CHAR c;
  1508. # endif
  1509. {
  1510.   IO_WriteC((System_tFile)IO_StdOutput, c);
  1511. }
  1512.  
  1513. static void unput
  1514. # ifdef __STDC__
  1515. (CHAR c)
  1516. # else
  1517. (c)
  1518. CHAR c;
  1519. # endif
  1520. {
  1521.   DEC(yyChBufferIndex);
  1522.   yyChBufferPtr->A[yyChBufferIndex] = c;
  1523. }
  1524.  
  1525. static CHAR input
  1526. # ifdef __STDC__
  1527. ()
  1528. # else
  1529. ()
  1530. # endif
  1531. {
  1532.   if (yyChBufferIndex == yyChBufferStart + yyBytesRead) {
  1533.     if (!yyEof) {
  1534.       DEC1(yyLineStart, yyBytesRead);
  1535.       yyChBufferIndex = 0;
  1536.       yyChBufferStart = 0;
  1537.       yyBytesRead = Source_GetLine(yySourceFile, (ADDRESS)yyChBufferPtr, (LONGCARD)General_Exp2(General_Log2(yyChBufferSize)));
  1538.       if (yyBytesRead <= 0) {
  1539.         yyBytesRead = 0;
  1540.         yyEof = TRUE;
  1541.       }
  1542.       yyChBufferPtr->A[yyBytesRead] = yyEobCh;
  1543.       yyChBufferPtr->A[yyBytesRead + 1] = '\0';
  1544.     }
  1545.   }
  1546.   if (yyChBufferIndex == yyChBufferStart + yyBytesRead) {
  1547.     return '\0';
  1548.   } else {
  1549.     INC(yyChBufferIndex);
  1550.     return yyChBufferPtr->A[yyChBufferIndex - 1];
  1551.   }
  1552. }
  1553.  
  1554. void Scanner_BeginScanner
  1555. # ifdef __STDC__
  1556. ()
  1557. # else
  1558. ()
  1559. # endif
  1560. {
  1561.   NestingLevel = 0;
  1562. }
  1563.  
  1564. void Scanner_CloseScanner
  1565. # ifdef __STDC__
  1566. ()
  1567. # else
  1568. ()
  1569. # endif
  1570. {
  1571. }
  1572.  
  1573. static void yyGetTables
  1574. # ifdef __STDC__
  1575. ()
  1576. # else
  1577. ()
  1578. # endif
  1579. {
  1580.   CARDINAL BlockSize, j, n;
  1581.   System_tFile TableFile;
  1582.   yyStateRange i;
  1583.   struct S_16 Base;
  1584.  
  1585.   BlockSize = 64000 / sizeof(yyCombType);
  1586.   TableFile = OpenInput(Scanner_ScanTabName.A, 128L);
  1587.   Checks_ErrorCheck((STRING)"yyGetTables.OpenInput", 21L, TableFile);
  1588.   if (yyGetTable(TableFile, ADR(Base)) / sizeof(yyTableElmt) - 1 != yyDStateCount || yyGetTable(TableFile, ADR(yyDefault)) / sizeof(yyTableElmt) - 1 != yyDStateCount || yyGetTable(TableFile, ADR(yyEobTrans)) / sizeof(yyTableElmt) - 1 != yyDStateCount) {
  1589.     yyErrorMessage(2);
  1590.   }
  1591.   n = 0;
  1592.   j = 0;
  1593.   while (j <= yyTableSize) {
  1594.     INC1(n, yyGetTable(TableFile, ADR(yyComb.A[j])) / sizeof(yyCombType));
  1595.     INC1(j, BlockSize);
  1596.   }
  1597.   if (n != yyTableSize + 1) {
  1598.     yyErrorMessage(2);
  1599.   }
  1600.   Close(TableFile);
  1601.   for (i = 0; i <= yyDStateCount; i += 1) {
  1602.     yyBasePtr.A[i] = (LONGCARD)ADR(yyComb.A[Base.A[i]]);
  1603.   }
  1604. }
  1605.  
  1606. static CARDINAL yyGetTable
  1607. # ifdef __STDC__
  1608. (System_tFile TableFile, ADDRESS Address)
  1609. # else
  1610. (TableFile, Address)
  1611. System_tFile TableFile;
  1612. ADDRESS Address;
  1613. # endif
  1614. {
  1615.   INTEGER N;
  1616.   yyTableElmt Length;
  1617.  
  1618.   N = Read(TableFile, ADR(Length), (LONGINT)sizeof(yyTableElmt));
  1619.   Checks_ErrorCheck((STRING)"yyGetTable.Read1", 16L, N);
  1620.   N = Read(TableFile, Address, (LONGINT)Length);
  1621.   Checks_ErrorCheck((STRING)"yyGetTable.Read2", 16L, N);
  1622.   return Length;
  1623. }
  1624.  
  1625. static void yyErrorMessage
  1626. # ifdef __STDC__
  1627. (SHORTCARD ErrorCode)
  1628. # else
  1629. (ErrorCode)
  1630. SHORTCARD ErrorCode;
  1631. # endif
  1632. {
  1633.   Positions_WritePosition((System_tFile)IO_StdError, Scanner_Attribute.Position);
  1634.   switch (ErrorCode) {
  1635.   case 0:;
  1636.     IO_WriteS((System_tFile)IO_StdError, (STRING)": Scanner: internal error", 25L);
  1637.     break;
  1638.   case 1:;
  1639.     IO_WriteS((System_tFile)IO_StdError, (STRING)": Scanner: out of memory", 24L);
  1640.     break;
  1641.   case 2:;
  1642.     IO_WriteS((System_tFile)IO_StdError, (STRING)": Scanner: table mismatch", 25L);
  1643.     break;
  1644.   case 3:;
  1645.     IO_WriteS((System_tFile)IO_StdError, (STRING)": Scanner: too many nested include files", 40L);
  1646.     break;
  1647.   case 4:;
  1648.     IO_WriteS((System_tFile)IO_StdError, (STRING)": Scanner: file stack underflow (too many calls of CloseFile)", 61L);
  1649.     break;
  1650.   case 5:;
  1651.     IO_WriteS((System_tFile)IO_StdError, (STRING)": Scanner: cannot open input file", 33L);
  1652.     break;
  1653.   }
  1654.   IO_WriteNl((System_tFile)IO_StdError);
  1655.   (*Scanner_Exit)();
  1656. }
  1657.  
  1658. static void yyExit
  1659. # ifdef __STDC__
  1660. ()
  1661. # else
  1662. ()
  1663. # endif
  1664. {
  1665.   IO_CloseIO();
  1666.   Exit(1L);
  1667. }
  1668.  
  1669. void BEGIN_Scanner()
  1670. {
  1671.   static BOOLEAN has_been_called = FALSE;
  1672.  
  1673.   if (!has_been_called) {
  1674.     has_been_called = TRUE;
  1675.  
  1676.     BEGIN_Strings();
  1677.     BEGIN_StringMem();
  1678.     BEGIN_Idents();
  1679.     BEGIN_Texts();
  1680.     BEGIN_Positions();
  1681.     BEGIN_Checks();
  1682.     BEGIN_System();
  1683.     BEGIN_General();
  1684.     BEGIN_Positions();
  1685.     BEGIN_IO();
  1686.     BEGIN_DynArray();
  1687.     BEGIN_Strings();
  1688.     BEGIN_Source();
  1689.     BEGIN_StringMem();
  1690.     BEGIN_Strings();
  1691.     BEGIN_Idents();
  1692.     BEGIN_Texts();
  1693.     BEGIN_Sets();
  1694.     BEGIN_Tree();
  1695.     BEGIN_Positions();
  1696.     BEGIN_Errors();
  1697.  
  1698.     (void)strncpy((char *)Scanner_ScanTabName.A, "Scanner.Tab", sizeof(Scanner_ScanTabName.A));
  1699.     Scanner_Exit = yyExit;
  1700.     yyFileStackPtr = 0;
  1701.     yyStartState = 1;
  1702.     yyPreviousStart = 1;
  1703.     yyBasePtr.A[yyStartState] = (LONGCARD)ADR(yyComb.A[0]);
  1704.     yyDefault.A[yyStartState] = yyDNoState;
  1705.     yyComb.A[0].Check = yyDNoState;
  1706.     yyChBufferPtr = (yytChBufferPtr)ADR(yyComb.A[0]);
  1707.     yyChBufferIndex = 1;
  1708.     yyStateStackSize = yyInitBufferSize;
  1709.     DynArray_MakeArray((ADDRESS *)&yyStateStack, &yyStateStackSize, (LONGINT)sizeof(yyStateRange));
  1710.     yyStateStack->A[0] = yyDNoState;
  1711.     for (yyCh = yyFirstCh; yyCh <= yyLastCh; yyCh += 1) {
  1712.       yyToLower.A[yyCh] = yyCh;
  1713.     }
  1714.     yyToUpper = yyToLower;
  1715.     for (yyCh = 'A'; yyCh <= 'Z'; yyCh += 1) {
  1716.       yyToLower.A[yyCh] = CHR(ORD(yyCh) - ORD('A') + ORD('a'));
  1717.     }
  1718.     for (yyCh = 'a'; yyCh <= 'z'; yyCh += 1) {
  1719.       yyToUpper.A[yyCh] = CHR(ORD(yyCh) - ORD('a') + ORD('A'));
  1720.     }
  1721.   }
  1722. }
  1723.